

//
//  ZZFirstViewModel.m
//  新项目
//
//  Created by 刘耀宗 on 2016/12/22.
//  Copyright © 2016年 刘耀宗. All rights reserved.
//

#import "ZZFirstViewModel.h"

@implementation ZZFirstViewModel
+ (instancetype)sharedViewModel {
    static id instance;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc] init];
    });
    
    return instance;
}
//首页查询
-(void)PayTheGoodsWithcompanyid:(NSString *)companyid andType:(NSString *)type  andStarTime:(NSString *)startTime andEndTime:(NSString *)endTime   andSuccess:(void (^)(NSDictionary *result))success andFailer:(void (^)())failer
{
    NSMutableDictionary *strDic=[NSMutableDictionary dictionary];
    [strDic setKey:@"companyid" forValue:companyid];
    [strDic setKey:@"type" forValue:type];//1:金额占比2：订单占比
    [strDic setKey:@"EndTime" forValue:endTime];
    [strDic setKey:@"StartTime" forValue:startTime];
    NSString *jsonStr=[WHJSON jsonStringWithObject:strDic];
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setKey:@"data" forValue:jsonStr];
    
    [YBHttpTool post:@"api/Statistics/Statistics/GetAppHomePage" params:dic success:^(NSDictionary *obj) {
        DLog(@"=====%@",obj);
        if ([obj isKindOfClass:[NSNull class]] || obj==nil) {
            DLog(@"返回值为空");
            return ;
        }
        success(obj);

    } failure:^(NSError *error) {
        failer();
    }];
    
}
@end
